public class revolveArray {

    public static void revolve(int[] nums,int k){
        for(int i=0;i<k;i++){
            int temp=nums[nums.length-1];
            for (int j = nums.length-1; j>0; j--) {
                nums[j]=nums[j-1];
            }
            nums[0]=temp;
        }
        System.out.println("1");
    }

    public static void revoveTwo(int[] nums,int k){
        int l=nums.length;
        int[] temp=new int[l];
        for (int i = 0; i <l ; i++) {
            temp[(i+k)%l]=nums[i];
        }
        System.arraycopy(temp,0,nums,0,l);
    }

    public static void main(String[] args) {
        int[] nums={1,2,3,4,5,6,7};
        revoveTwo(nums,3);
    }
}
